home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1998 July
/
EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso
/
earkit
/
news
/
thor
/
hd-install
/
thor25_arexx.lha
/
Edge
/
UUEncode.edge
< prev
Wrap
Text File
|
1996-01-13
|
3KB
|
108 lines
/* UUEncode.edge
** $VER: UUEncode.edge v1.2 (27.12.96)
** Original script by Troels Walsted Hansen
** An ARexx script that uuencodes a file and imports it into the
** EDGE you are currently using. Unless the file is already
** archived this script will optionally do it for you (using LhA).
**
** Utilizes LhA by Stefan Boberg and either of the following:
** · UUFast v1.25 by Jørn Halonen
** · uuIn v1.03 by Nicolas Dade
** · UUxT v3.1 by Asher Feldman
**
** · proudly plagerized from THOR's archive ;^)
*/
/* some user variables. edit to your hearts content */
tmpdir = "T:" /* Work dir for the encoding */
uuencoder = "uuxt" /* may be: "uuin", "uufast" or "uuxt" */
uuprogpath = "C:" /* Path to your uuencoder. This path */
/* MUST end with either ':' or '/'. */
/* do NOT edit below here unless you know what you're doing :-) */
options results
/* needs EDGE and bbsread.library functions */
if(substr(address(),1,4) ~= "EDGE") then
do
say "This script should only be started from inside EDGE."
exit 20
end
else edgeport = address()
if ~show('p', 'BBSREAD') then
do
address command
"run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
"WaitForPort BBSREAD"
end
/* get filename */
address(bbsread)
GETGLOBALDATA STEM GLOBALDATA
address(edgeport)
REQUESTFILE title '"Select file to encode:"' PATH GLOBALDATA.UPLOADPATH
filetoencode=result
if(rc ~= 0) then exit
lastchar = right(filetoencode,1)
if(lastchar = "/" | lastchar = ":" | filetoencode = "") then
do
REQUESTNOTIFY '"No file selected!"' TITLE '"Error"' result
signal exit
end
posi = lastpos("/",FileToEncode)
if(posi = 0) then posi = lastpos(":",FileToEncode)
WithoutPath = substr(FileToEncode,posi+1)
/* if file isn't LhA'ed -- do it ourselves */
extension = upper(substr(FileToEncode, lastpos(".",FileToEncode)+1))
if~(extension = "LHA" | extension = "LZH") then
do
REQUESTCHOICE TITLE 'UUEncode.edge' STRING 'Do you want to LhA the file?' result
if RC==0 then
do
address command "LhA >nil: -y -q a "||'"'tmpdir||WithoutPath'"'||" "||'"'FileToEncode'"'
if(rc ~= 0) then REQUESTNOTIFY '"LhA''ing did not succeed."' TITLE '"UUEncode.edge"' result
else FileToEncode = tmpdir||WithoutPath||".lha"
end
end
select
when(upper(uuencoder) = 'UUFAST') then cmd = uuprogpath || 'UUFast >nil: ' || '"' || filetoencode || '"' || " TO " || tmpdir || "Message.uu E"
when(upper(uuencoder) = 'UUIN') then cmd = uuprogpath || 'uuIn >nil: INFILE=' || '"' || filetoencode || '"' || " OUTFILE=" || tmpdir || "Message.uu"
when(upper(uuencoder) = 'UUXT') then cmd = uuprogpath || 'UUxT >nil: a ' || tmpdir || 'Message.uu ' || '"'filetoencode'"'
otherwise
do
REQUESTNOTIFY '"UUEncoder not configured correctly."' TITLE '"UUEncode.edge"' result
signal exit
end
end
address command cmd
if ~exists(tmpdir"Message.uu") then
do
REQUESTNOTIFY '"Something went wrong during uuencoding."' TITLE '"UUEncode.edge"' result
signal exit
end
address(edgeport)
INCLUDE '"' || tmpdir || 'Message.uu' || '"'
/* cleanup and exit */
exit:
if(exists(tmpdir || WithoutPath || ".lha")) then address command 'delete >nil: ' || '"' || tmpdir || WithoutPath || '.lha' || '"'
if(exists(tmpdir || "Message.uu")) then address command 'delete >nil: ' || tmpdir || 'Message.uu'
exit